home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Information / Programming / Writing System Extensions / Writing System Extensions 3⁄3 < prev   
Encoding:
Text File  |  1994-12-03  |  14.7 KB  |  24 lines  |  [TEXT/R*ch]

  1. [19] How do I patch a trap?
  2.  
  3. Here is some sample code for a head patch of Alert, a stack-based 
  4. trap:
  5.  
  6. TrapPtr  gOldAlertTrapAddress;
  7.  
  8. /****InstallPatch***************************************************/
  9.  
  10. void 
  11. InstallPatch (void)
  12. {
  13.    gOldAlertTrapAddress = GetToolTrapAddress( _Alert );
  14.    SetToolTrapAddress( (long) AlertPatch, _Alert );
  15. }
  16.  
  17. /****AlertPatch***************************************************/
  18.  
  19. pascal void 
  20. AlertPatch( short alertID, ProcPtr filterProcPtr )
  21. {
  22.    SetUpA4();
  23.  
  24.    MyAlert( alert